textview: Update child allocations
authorMatthias Clasen <mclasen@redhat.com>
Thu, 29 Oct 2020 00:18:54 +0000 (20:18 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 29 Oct 2020 00:18:54 +0000 (20:18 -0400)
This was accidentally lost when display line caching
was introduced.

gtk/gtktextlayout.c
gtk/gtktextlayoutprivate.h
gtk/gtktextlinedisplaycache.c

index e6c5b5b2807cc1763ee2b4f46371685dd25185ad..57983ae6b7077bb3d55b1b9506c90ccf4c639b9b 100644 (file)
@@ -2002,6 +2002,13 @@ allocate_child_widgets (GtkTextLayout      *text_layout,
   pango_layout_iter_free (run_iter);
 }
 
+void
+gtk_text_layout_update_children (GtkTextLayout      *text_layout,
+                                 GtkTextLineDisplay *display)
+{
+  allocate_child_widgets (text_layout, display);
+}
+
 static void
 convert_color (GdkRGBA        *result,
               PangoAttrColor *attr)
@@ -2663,6 +2670,8 @@ gtk_text_layout_create_display (GtkTextLayout *layout,
   if (tags != NULL)
     g_ptr_array_free (tags, TRUE);
 
+  display->has_children = saw_widget;
+
   if (saw_widget)
     allocate_child_widgets (layout, display);
   
index 2f0c7122f1505b0c0d78c608031f213dbb9f13ef..368cfd0940c9c163979252a4f4ce4df7f5c1eacf 100644 (file)
@@ -214,13 +214,15 @@ struct _GtkTextLineDisplay
   GtkTextLine *line;
 
   GdkRectangle block_cursor;
+
   guint cursors_invalid : 1;
   guint has_block_cursor : 1;
   guint cursor_at_line_end : 1;
   guint size_only : 1;
+  guint pg_bg_rgba_set : 1;
+  guint has_children : 1;
 
   GdkRGBA pg_bg_rgba;
-  guint pg_bg_rgba_set : 1;
 };
 
 #ifdef GTK_COMPILATION
@@ -337,6 +339,8 @@ GtkTextLineDisplay *gtk_text_layout_create_display (GtkTextLayout *layout,
 void     gtk_text_layout_update_display_cursors (GtkTextLayout      *layout,
                                                  GtkTextLine        *line,
                                                  GtkTextLineDisplay *display);
+void     gtk_text_layout_update_children        (GtkTextLayout      *layout,
+                                                 GtkTextLineDisplay *display);
 gboolean _gtk_text_layout_get_block_cursor    (GtkTextLayout     *layout,
                                               GdkRectangle      *pos);
 gboolean gtk_text_layout_clamp_iter_to_vrange (GtkTextLayout     *layout,
index 27f05ad660da9c444b34ae182ce7b1b76fad5b69..677de11572cb2ee482d88fddaad6f4f465824eae 100644 (file)
@@ -294,6 +294,9 @@ gtk_text_line_display_cache_get (GtkTextLineDisplayCache *cache,
           if (!size_only && display->line == cache->cursor_line)
             gtk_text_layout_update_display_cursors (layout, display->line, display);
 
+          if (!size_only && display->has_children)
+            gtk_text_layout_update_children (layout, display);
+
           /* Move to front of MRU */
           g_queue_unlink (&cache->mru, &display->mru_link);
           g_queue_push_head_link (&cache->mru, &display->mru_link);
@@ -322,6 +325,9 @@ gtk_text_line_display_cache_get (GtkTextLineDisplayCache *cache,
       if (line == cache->cursor_line)
         gtk_text_layout_update_display_cursors (layout, line, display);
 
+      if (display->has_children)
+        gtk_text_layout_update_children (layout, display);
+
       gtk_text_line_display_cache_take_display (cache,
                                                 gtk_text_line_display_ref (display),
                                                 layout);